package com.yidu.logisticssystem.service.impl;

import com.yidu.logisticssystem.entity.LogisticsWageNorm;
import com.yidu.logisticssystem.dao.LogisticsWageNormDao;
import com.yidu.logisticssystem.entity.vo.WageNormVo;
import com.yidu.logisticssystem.service.LogisticsWageNormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 基本工资标准表(LogisticsWageNorm)表服务实现类
 *
 * @author 宋玉玲
 * @since 2021-03-17 14:59:21
 */
@Service("logisticsWageNormService")
public class LogisticsWageNormServiceImpl implements LogisticsWageNormService {
    /**
     * 服务对象
     */
    //jdk8这么写@Resource
    @Resource
    private LogisticsWageNormDao logisticsWageNormDao;

    /**
     * 通过ID查询单条数据
     *
     * @param moneyId 主键
     * @return 实例对象
     */
    @Override
    public LogisticsWageNorm queryById(Integer moneyId) {
        return this.logisticsWageNormDao.queryById(moneyId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<LogisticsWageNorm> queryAllByLimit(int offset, int limit) {
        return this.logisticsWageNormDao.queryAllByLimit(offset, limit);
    }

    /**
     * 查询所有
     * @param vo 实例对象
     * @return
     */
    @Override
    public List<LogisticsWageNorm> queryAll(WageNormVo vo) {
        return this.logisticsWageNormDao.queryAll(vo);
    }

    /**
     * 新增数据
     *
     * @param logisticsWageNorm 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsWageNorm insert(LogisticsWageNorm logisticsWageNorm) {
        this.logisticsWageNormDao.insert(logisticsWageNorm);
        return logisticsWageNorm;
    }

    @Override
    public LogisticsWageNorm insertSelective(LogisticsWageNorm logisticsWageNorm) {
        this.logisticsWageNormDao.insertSelective(logisticsWageNorm);
        return logisticsWageNorm;
    }

    /**
     * 修改数据
     *
     * @param logisticsWageNorm 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsWageNorm update(LogisticsWageNorm logisticsWageNorm) {
        this.logisticsWageNormDao.update(logisticsWageNorm);
        return this.queryById(logisticsWageNorm.getMoneyId());
    }

    /**
     * 通过主键删除数据
     *
     * @param moneyId 主键
     * @return 是否成功
     */
    @Override
    public int deleteById(Integer moneyId) {
        return this.logisticsWageNormDao.deleteById(moneyId);
    }

    @Override
    public int delete(String moneyId) {
        String[] idArray = moneyId.split(",");
        return this.logisticsWageNormDao.delete(idArray);
    }

    @Override
    public int query(LogisticsWageNorm logisticsWageNorm) {
        return this.logisticsWageNormDao.query(logisticsWageNorm);
    }
}
